package com.uex.dev.manage.admin.vo.device;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.uex.dev.manage.admin.enums.DeviceTypeEnum;
import com.uex.dev.manage.admin.po.DevicePO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.time.LocalDateTime;

/**
 * @author lzs
 * @create 2024/02/23
 * @description
 */
@Schema(description = "设备列表响应参数")
@Data
public class DevicePageResp {
    @Schema(description = "设备Id")
    private Integer id;
    @Schema(description = "设备唯一标识")
    private String deviceToken;
    @Schema(description = "项目ID")
    private Integer devicePrjid;
    @Schema(description = "项目名称")
    private String prjName;
    @Schema(description = "设备类型")
    private DeviceTypeEnum deviceType;
    @Schema(description = "设备型号")
    private String deviceModel;
    @Schema(description = "设备型号ID")
    private Integer deviceModelid;
    @Schema(description = "维保结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime deviceMaintainTime;
    @Schema(description = "设备激活时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime deviceActiveTime;

    public static DevicePageResp fromPO(DevicePO devicePO) {
        DevicePageResp devicePageResp = new DevicePageResp();
        BeanUtils.copyProperties(devicePO, devicePageResp);
        return devicePageResp;
    }
}

